package enemies;

import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.Sprite;

public class Rock {

	private int posX;
	private int posY;
	private int height;
	private int width;
	private int frame;
	private Image rock;
	public Sprite rocksprite;
	
	public Rock(int posX, int posY){
		this.posX = posX;
		this.posY = posY;
		this.height = 30;
		this.width = 30;
		rock = loadImage("/sprites/rock.png");
		rocksprite = new Sprite(rock, height, width);
		rocksprite.setFrame(0);
		rocksprite.setPosition(posX, posY);
	}

	public int getPosX() {
		return posX;
	}

	public void setPosX(int posX) {
		this.posX = posX;
		rocksprite.setPosition(this.posX, this.posY);
	}

	public int getPosY() {
		return posY;
	}

	public void setPosY(int posY) {
		this.posY = posY;
		rocksprite.setPosition(this.posX, this.posY);
	}
	
	public void setPosition(int x, int y){
		this.posX = x;
		this.posY = y;
		rocksprite.setPosition(this.posX, this.posY);
	}

	public int getHeight() {
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}
	
	public int getFrame() {
		return frame;
	}

	public void setFrame(int f) {
		this.frame = f;
		rocksprite.setFrame(frame);
	}
	
	
	private Image loadImage(String s) {
		try {
			return Image.createImage(s);
		} catch (Exception e) {
			System.out.println("Fehler beim Laden vom Bild:"+s);
		}
		return null;
	}
	
}
